﻿using System.Diagnostics;

namespace DimensionsHelper.LanguageService.Syntax;

public class MetadataTemplates : MetadataListWithAreal<MetadataTemplate>
{
    internal MetadataTemplates(SyntaxNode? parent, SyntaxToken declareKeywordToken) :
        base(SyntaxKinds.MetadataTemplates, parent)
    {
        DeclareKeywordToken = declareKeywordToken;
    }

    public SyntaxToken DeclareKeywordToken { get; }


    public override void AcceptVisitor<T>(SyntaxNodeVisitor<T> visitor)
    {
        Accept(visitor, DeclareKeywordToken);
        base.AcceptVisitor(visitor);
    }
}


public static partial class NodeFactory
{
    public static MetadataTemplates CreateMetadataTemplates(SyntaxNode? parent, SyntaxToken templateKeywordToken,
        IEnumerable<MetadataTemplate>? templates)
    {
        Debug.Assert(templateKeywordToken.IsNode(SyntaxKinds.TemplatesKeywordToken));
        MetadataTemplates list = new(parent, templateKeywordToken);
        return InitializeMetadataListWithAreal(list, templates);
    }
}